package com.yexiong.test;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.List;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import com.common.entity.DataPack;
import com.common.entity.Employee;
import javax.swing.JButton;

public class asf extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					asf frame = new asf();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public asf() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		JButton btnNewButton = new JButton("New button");
		contentPane.add(btnNewButton, BorderLayout.CENTER);
		init();
	}
	public void init() {
		DataPack dataPack=new DataPack();
		dataPack.setOptType("getAll");
		dataPack.setOptClassName("com.zekai.server.process.EmployeeServiceProcess");
		dataPack.setCon(1);
		Socket socket;
		try {
			socket = new Socket("127.0.0.1", 9900);
			ObjectOutputStream objectOutputStream=new ObjectOutputStream(socket.getOutputStream());
			ObjectInputStream objectInputStream=new ObjectInputStream(socket.getInputStream());
			objectOutputStream.writeObject(dataPack);
			objectOutputStream.flush();
			List<Employee> list1=(List<Employee>)objectInputStream.readObject();
			System.out.println(list1);
			System.out.println("sdf");
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
